package com.ssy.lingxi.enhance.serviceimpl.supplier;

import com.querydsl.core.BooleanBuilder;
import com.ssy.lingxi.common.exception.BusinessException;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.enhance.constant.*;
import com.ssy.lingxi.enhance.entity.*;
import com.ssy.lingxi.enhance.handler.async.MessageAsyncService;
import com.ssy.lingxi.enhance.handler.async.ReportAsyncService;
import com.ssy.lingxi.enhance.handler.jpa.QueryDslUtil;
import com.ssy.lingxi.enhance.handler.utils.DoubleUtil;
import com.ssy.lingxi.enhance.model.bo.PNOReceiveDeliverDetailProductBO;
import com.ssy.lingxi.enhance.model.dto.CommonIdDTO;
import com.ssy.lingxi.enhance.model.dto.ConfirmReceiveDeliverReceiptDTO;
import com.ssy.lingxi.enhance.model.qo.ProduceNoticeOrderQO;
import com.ssy.lingxi.enhance.model.vo.ProduceNoticeOrderListVO;
import com.ssy.lingxi.enhance.repository.*;
import com.ssy.lingxi.enhance.service.supplier.SupplierToBeReceiveService;
import com.ssy.lingxi.message.api.constant.MessageTemplateCode;
import com.ssy.lingxi.report.api.enums.EnhanceProcessOperateTypeEnum;
import com.ssy.lingxi.report.api.enums.EnhanceSupplierOperateTypeEnum;
import com.ssy.lingxi.report.api.enums.OperateDataSourceEnum;
import com.ssy.lingxi.report.api.vo.request.OperateNoticeVO;
import com.ssy.lingxi.workflow.api.feign.ProcessFeign;
import com.ssy.lingxi.workflow.api.model.contant.ProcessTaskStatusEnum;
import com.ssy.lingxi.workflow.api.model.vo.request.TaskExecuteVO;
import com.ssy.lingxi.workflow.api.model.vo.response.SimpleTaskCompleteVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 加工能力 - 指派生产通知单(供应商) - 待收货生产通知单 - 业务实现层
 * @author fhj
 * @date 2020/10/20
 * @version 2.0.0
 */
@Slf4j
@Service
public class SupplierToBeReceiveServiceImpl implements SupplierToBeReceiveService {

    @Resource
    private ProcessFeign processFeign;
    @Resource
    private QueryDslUtil queryDslUtil;
    @Resource
    private ProduceNoticeOrderRepository produceNoticeOrderRepository;
    @Resource
    private ProduceNoticeOrderDetailRepository produceNoticeOrderDetailRepository;
    @Resource
    private PNOReceiveDeliverDetailRepository pnoReceiveDeliverDetailRepository;
    @Resource
    private InnerWorkflowRecordRepository innerWorkflowRecordRepository;
    @Resource
    private OuterWorkflowRecordRepository outerWorkflowRecordRepository;
    @Resource
    private ReportAsyncService reportAsyncService;
    @Resource
    private MessageAsyncService messageAsyncService;
    @Resource
    private PNOSettleDetailRepository pnoSettleDetailRepository;

    /**
     * 列表
     * */
    @Override
    public Wrapper<PageData<ProduceNoticeOrderListVO>> list(ProduceNoticeOrderQO qo, UserLoginCacheDTO user) {
        //查询表实体 - 生产通知单
        QProduceNoticeOrderDO pno = QProduceNoticeOrderDO.produceNoticeOrderDO;

        //查询条件构造 - 必要条件
        BooleanBuilder predicates = new BooleanBuilder();
        predicates.and(pno.supplierMemberId.eq(user.getMemberId()));
        predicates.and(pno.supplierRoleId.eq(user.getMemberRoleId()));
        predicates.and(pno.outerStatus.eq(PNOOuterStatusEnum.TO_BE_RECEIVE.getCode()));
        predicates.and(pno.status.eq(PNOAllStatusEnum.TO_BE_SUPPLIER_CONFIRM_RECEIVE.getCode()));

        return Wrapper.success(queryDslUtil.getSupplierPNOList(qo, pno, predicates));
    }

    /**
     * 确认收货
     * */
    @Override
    @Transactional
    public Wrapper<Void> confirmReceive(ConfirmReceiveDeliverReceiptDTO dto, UserLoginCacheDTO user) {
        //根据ID获取生产通知单详情
        ProduceNoticeOrderDO produceNoticeOrder = produceNoticeOrderRepository.findById(dto.getProduceNoticeOrderId()).orElse(null);
        if(produceNoticeOrder == null) {
            return Wrapper.fail(ResponseCode.ENHANCE_BY_ID_NOT_FOUND_PNO);
        }
        if(!produceNoticeOrder.getStatus().equals(PNOAllStatusEnum.TO_BE_SUPPLIER_CONFIRM_RECEIVE.getCode())) {
            return Wrapper.fail(ResponseCode.ENHANCE_ONLY_OPERATION_INNER_STATUS_AS_TO_BE_SUPPLIER_CONFIRM_RECEIVE);
        }

        //根据ID获取生产通知单收发货明细详情
        PNOReceiveDeliverDetailDO pnoReceiveDeliverDetail = pnoReceiveDeliverDetailRepository.findById(dto.getPnoReceiveDeliverDetailId()).orElse(null);
        if(pnoReceiveDeliverDetail == null) {
            return Wrapper.fail(ResponseCode.ENHANCE_BY_ID_NOT_FOUND_PNO);
        }
        if(!pnoReceiveDeliverDetail.getReceiveStatus().equals(ReceiveStatusEnum.TO_BE_CONFIRM_RECEIVE.getCode())) {
            return Wrapper.fail(ResponseCode.ENHANCE_PNO_RECEIVE_DELIVER_DETAIL_MUST_BE_TO_BE_CONFIRM_RECEIVE);
        }

        //定义OperateNoticeVO集合
        List<OperateNoticeVO> noticeVOList = new ArrayList<>();

        //调用工作流服务 -> 执行外部流程
        TaskExecuteVO taskExecuteVO = new TaskExecuteVO();
        taskExecuteVO.setMemberId(produceNoticeOrder.getSupplierMemberId());
        taskExecuteVO.setRoleId(produceNoticeOrder.getSupplierRoleId());
        taskExecuteVO.setDataId(produceNoticeOrder.getId());
        taskExecuteVO.setTaskId(produceNoticeOrder.getOuterTaskId());
        taskExecuteVO.setAgree(ProcessTaskStatusEnum.GOTO_NEXT_STEP.getCode());
        taskExecuteVO.setProcessKey(produceNoticeOrder.getOuterProcessKey());
        Wrapper<SimpleTaskCompleteVO> outerWrapper = processFeign.completeSimpleTask(taskExecuteVO);
        if(ResponseCode.SUCCESS.getCode() == outerWrapper.getCode()) {
            //记录外部工作流记录
            OuterWorkflowRecordDO outerWorkflowRecordDO = new OuterWorkflowRecordDO();
            outerWorkflowRecordDO.setProduceNoticeOrderId(produceNoticeOrder.getId());
            outerWorkflowRecordDO.setUserId(user.getUserId());
            outerWorkflowRecordDO.setMemberId(user.getMemberId());
            outerWorkflowRecordDO.setRoleId(user.getMemberRoleId());
            outerWorkflowRecordDO.setStep(produceNoticeOrder.getOuterStatus());
            outerWorkflowRecordDO.setRoleName(user.getMemberRoleName());
            outerWorkflowRecordDO.setStatus("待确认回单通知单");
            outerWorkflowRecordDO.setOperate("生产通知单收货");
            outerWorkflowRecordDO.setOperateTime(System.currentTimeMillis());
            outerWorkflowRecordDO.setOpinion("确认收货");
            outerWorkflowRecordRepository.saveAndFlush(outerWorkflowRecordDO);

            //记录供应商内部工作流记录
            InnerWorkflowRecordDO innerWorkflowRecord = new InnerWorkflowRecordDO();
            innerWorkflowRecord.setProduceNoticeOrderId(produceNoticeOrder.getId());
            innerWorkflowRecord.setUserId(user.getUserId());
            innerWorkflowRecord.setMemberId(user.getMemberId());
            innerWorkflowRecord.setRoleId(user.getMemberRoleId());
            innerWorkflowRecord.setType(RoleTypeEnum.SUPPLIER.getCode());
            innerWorkflowRecord.setStep(produceNoticeOrder.getStatus());
            innerWorkflowRecord.setOperator(user.getUserName());
            innerWorkflowRecord.setDepartment(user.getUserOrgName());
            innerWorkflowRecord.setJobTitle(user.getUserJobTitle());
            innerWorkflowRecord.setStatus("已确认收货");
            innerWorkflowRecord.setOperate("生产通知单收货");
            innerWorkflowRecord.setOperateTime(System.currentTimeMillis());
            innerWorkflowRecord.setOpinion("确认收货");
            innerWorkflowRecordRepository.saveAndFlush(innerWorkflowRecord);

            //更新外部状态、外部任务ID、状态、供应商内部状态、加工企业内部状态
            produceNoticeOrder.setOuterStatus(outerWrapper.getData().getStatus());
            produceNoticeOrder.setOuterTaskId(outerWrapper.getData().getTaskId());
            produceNoticeOrder.setStatus(PNOAllStatusEnum.TO_BE_PROCESS_CONFIRM_RECEIPT.getCode());
            produceNoticeOrder.setSupplierInnerStatus(PNOSupplierInnerStatusEnum.ALREADY_CONFIRM_RECEIVE.getCode());
            produceNoticeOrder.setProcessInnerStatus(PNOProcessInnerStatusEnum.TO_BE_CONFIRM_RECEIPT.getCode());
            produceNoticeOrderRepository.saveAndFlush(produceNoticeOrder);

            //更新生产通知单收发货明细：收货时间、收货状态
            pnoReceiveDeliverDetail.setReceiveTime(System.currentTimeMillis());
            pnoReceiveDeliverDetail.setReceiveStatus(ReceiveStatusEnum.ALREADY_CONFIRM_RECEIVE.getCode());
            pnoReceiveDeliverDetailRepository.saveAndFlush(pnoReceiveDeliverDetail);

            //获取到生产通知单收发货明细商品进行遍历, 更新每一个生产通知单明细的商品的收货数量、差异数量
            List<PNOReceiveDeliverDetailProductBO> pnoReceiveDeliverDetailProductBOList = pnoReceiveDeliverDetail.getPnoReceiveDeliverDetailProductBOList();
            for(PNOReceiveDeliverDetailProductBO bo:pnoReceiveDeliverDetailProductBOList) {
                ProduceNoticeOrderDetailDO produceNoticeOrderDetailDO = produceNoticeOrderDetailRepository.findById(bo.getProduceNoticeOrderDetailId()).orElse(null);
                if(produceNoticeOrderDetailDO != null) {
                    produceNoticeOrderDetailDO.setReceiveNum(DoubleUtil.add(produceNoticeOrderDetailDO.getReceiveNum(), bo.getStorageNum()));
                    produceNoticeOrderDetailDO.setDifferenceNum(DoubleUtil.sub(produceNoticeOrderDetailDO.getDeliverNum(), produceNoticeOrderDetailDO.getReceiveNum()));
                    produceNoticeOrderDetailRepository.saveAndFlush(produceNoticeOrderDetailDO);
                }
            }

            //新增生产通知单结算信息, 对生成通知单收完货得每一批次进行计算且插入, 针对(是否含税+税率)相同得商品要进行拆分。
            List<PNOSettleDetailDO> list = new ArrayList<>();
            Map<String, List<PNOReceiveDeliverDetailProductBO>> map = pnoReceiveDeliverDetailProductBOList.stream().collect(Collectors.groupingBy(a -> a.getIsHasTax() + "_" + a.getTaxRate()));
            for (String key:map.keySet()) {
                List<PNOReceiveDeliverDetailProductBO> bos = map.get(key);
                PNOSettleDetailDO pnoSettleDetailDO = new PNOSettleDetailDO();
                pnoSettleDetailDO.setProduceNoticeOrderId(produceNoticeOrder.getId());
                pnoSettleDetailDO.setPnoReceiveDeliverDetailId(pnoReceiveDeliverDetail.getId());
                pnoSettleDetailDO.setNoticeNo(produceNoticeOrder.getNoticeNo());
                pnoSettleDetailDO.setSummary(produceNoticeOrder.getSummary());
                pnoSettleDetailDO.setProduceNoticeOrderTime(produceNoticeOrder.getCreateTime());
                pnoSettleDetailDO.setIsHasTax(bos.get(0).getIsHasTax());
                pnoSettleDetailDO.setTaxRate(bos.get(0).getTaxRate());
                pnoSettleDetailDO.setProcessTotalPrice(produceNoticeOrder.getProcessTotalPrice());
                pnoSettleDetailDO.setBatch(pnoReceiveDeliverDetail.getDeliveryBatch());
                pnoSettleDetailDO.setReceiveTime(pnoReceiveDeliverDetail.getReceiveTime());
                pnoSettleDetailDO.setReceiveNum(bos.stream().mapToDouble(PNOReceiveDeliverDetailProductBO::getStorageNum).sum());
                double receivePrice = 0.0;
                for (PNOReceiveDeliverDetailProductBO bo:bos) {
                    receivePrice = DoubleUtil.add(receivePrice, DoubleUtil.mul(bo.getProcessPrice(), bo.getStorageNum()));
                }
                pnoSettleDetailDO.setReceivePrice(receivePrice);
                list.add(pnoSettleDetailDO);
            }
            pnoSettleDetailRepository.saveAll(list);

        }else {
            log.error("工作流服务异常:" + outerWrapper.getMessage());
            throw new BusinessException(ResponseCode.ENHANCE_WORKFLOW_ERROR);
        }

        //指派生产通知单 - 待收货生产通知单 - 待办减1
        OperateNoticeVO supplierNoticeVO = new OperateNoticeVO();
        supplierNoticeVO.setMemberId(user.getMemberId());
        supplierNoticeVO.setRoleId(user.getMemberRoleId());
        supplierNoticeVO.setDataSource(OperateDataSourceEnum.ENHANCE_SUPPLIER.getCode());
        supplierNoticeVO.setReduceOperateType(EnhanceSupplierOperateTypeEnum.TO_BE_RECEIVE.getCode());
        supplierNoticeVO.setReduceCount(1L);
        noticeVOList.add(supplierNoticeVO);
        //确认生产通知单 - 待确认回单生产通知单 - 待办加1
        OperateNoticeVO processNoticeVO = new OperateNoticeVO();
        processNoticeVO.setMemberId(produceNoticeOrder.getProcessMemberId());
        processNoticeVO.setRoleId(produceNoticeOrder.getProcessRoleId());
        processNoticeVO.setDataSource(OperateDataSourceEnum.ENHANCE_PROCESS.getCode());
        processNoticeVO.setIncreaseOperateType(EnhanceProcessOperateTypeEnum.TO_BE_CONFIRM_RECEIPT.getCode());
        processNoticeVO.setIncreaseCount(1L);
        noticeVOList.add(processNoticeVO);

        //调用报表服务、消息服务 -> 批量新增操作通知、发送系统消息（如果调用过程出现异常, 无需回滚, 直接catch打印日志正常返回。）
        reportAsyncService.addOperateNoticeList(noticeVOList);
        messageAsyncService.sendSystemMessage(produceNoticeOrder.getProcessMemberId(), produceNoticeOrder.getProcessRoleId(),
                MessageTemplateCode.production_order_handle_receipt, Stream.of(produceNoticeOrder.getNoticeNo(), produceNoticeOrder.getSummary()).collect(Collectors.toList())
        );

        return Wrapper.success();
    }

    /**
     * 手工收货
     * */
    @Override
    @Transactional
    public Wrapper<Void> manualReceive(CommonIdDTO dto, UserLoginCacheDTO user) {
        //根据ID获取生产通知单详情
        ProduceNoticeOrderDO produceNoticeOrder = produceNoticeOrderRepository.findById(dto.getId()).orElse(null);
        if(produceNoticeOrder == null) {
            return Wrapper.fail(ResponseCode.ENHANCE_BY_ID_NOT_FOUND_PNO);
        }
        if(!produceNoticeOrder.getStatus().equals(PNOAllStatusEnum.TO_BE_SUPPLIER_CONFIRM_RECEIVE.getCode())) {
            return Wrapper.fail(ResponseCode.ENHANCE_ONLY_OPERATION_INNER_STATUS_AS_TO_BE_SUPPLIER_CONFIRM_RECEIVE);
        }

        //调用工作流服务 -> 执行外部流程
        TaskExecuteVO taskExecuteVO = new TaskExecuteVO();
        taskExecuteVO.setMemberId(produceNoticeOrder.getSupplierMemberId());
        taskExecuteVO.setRoleId(produceNoticeOrder.getSupplierRoleId());
        taskExecuteVO.setDataId(produceNoticeOrder.getId());
        taskExecuteVO.setTaskId(produceNoticeOrder.getOuterTaskId());
        taskExecuteVO.setAgree(ProcessTaskStatusEnum.GOTO_NEXT_STEP.getCode());
        taskExecuteVO.setProcessKey(produceNoticeOrder.getOuterProcessKey());
        Wrapper<SimpleTaskCompleteVO> outerWrapper = processFeign.completeSimpleTask(taskExecuteVO);
        if(ResponseCode.SUCCESS.getCode() == outerWrapper.getCode()) {
            //记录外部工作流记录
            OuterWorkflowRecordDO outerWorkflowRecordDO = new OuterWorkflowRecordDO();
            outerWorkflowRecordDO.setProduceNoticeOrderId(produceNoticeOrder.getId());
            outerWorkflowRecordDO.setUserId(user.getUserId());
            outerWorkflowRecordDO.setMemberId(user.getMemberId());
            outerWorkflowRecordDO.setRoleId(user.getMemberRoleId());
            outerWorkflowRecordDO.setStep(produceNoticeOrder.getOuterStatus());
            outerWorkflowRecordDO.setRoleName(user.getMemberRoleName());
            outerWorkflowRecordDO.setStatus("已完成通知单");
            outerWorkflowRecordDO.setOperate("生产通知单收货");
            outerWorkflowRecordDO.setOperateTime(System.currentTimeMillis());
            outerWorkflowRecordDO.setOpinion("确认收货");
            outerWorkflowRecordRepository.saveAndFlush(outerWorkflowRecordDO);

            //记录供应商内部工作流记录
            InnerWorkflowRecordDO innerWorkflowRecord = new InnerWorkflowRecordDO();
            innerWorkflowRecord.setProduceNoticeOrderId(produceNoticeOrder.getId());
            innerWorkflowRecord.setUserId(user.getUserId());
            innerWorkflowRecord.setMemberId(user.getMemberId());
            innerWorkflowRecord.setRoleId(user.getMemberRoleId());
            innerWorkflowRecord.setType(RoleTypeEnum.SUPPLIER.getCode());
            innerWorkflowRecord.setStep(produceNoticeOrder.getStatus());
            innerWorkflowRecord.setOperator(user.getUserName());
            innerWorkflowRecord.setDepartment(user.getUserOrgName());
            innerWorkflowRecord.setJobTitle(user.getUserJobTitle());
            innerWorkflowRecord.setStatus("已确认收货");
            innerWorkflowRecord.setOperate("生产通知单收货");
            innerWorkflowRecord.setOperateTime(System.currentTimeMillis());
            innerWorkflowRecord.setOpinion("确认收货");
            innerWorkflowRecordRepository.saveAndFlush(innerWorkflowRecord);

            //更新外部状态、外部任务ID、状态、供应商内部状态、加工企业内部状态
            produceNoticeOrder.setOuterStatus(outerWrapper.getData().getStatus());
            produceNoticeOrder.setOuterTaskId(outerWrapper.getData().getTaskId());
            produceNoticeOrder.setStatus(PNOAllStatusEnum.COMPLETE.getCode());
            produceNoticeOrder.setSupplierInnerStatus(PNOSupplierInnerStatusEnum.ALREADY_COMPLETE.getCode());
            produceNoticeOrder.setProcessInnerStatus(PNOProcessInnerStatusEnum.ALREADY_COMPLETE.getCode());
            produceNoticeOrderRepository.saveAndFlush(produceNoticeOrder);

            //获取生产通知单明细
            List<ProduceNoticeOrderDetailDO> details = produceNoticeOrderDetailRepository.findByProduceNoticeOrderId(produceNoticeOrder.getId());
            //新增生产通知单收发货明细（冗余数据，即使是手工收货，也需要统计结算）
            PNOReceiveDeliverDetailDO pnoReceiveDeliverDetailDO = new PNOReceiveDeliverDetailDO();
            pnoReceiveDeliverDetailDO.setProduceNoticeOrderId(produceNoticeOrder.getId());
            pnoReceiveDeliverDetailDO.setNoticeNo(produceNoticeOrder.getNoticeNo());
            pnoReceiveDeliverDetailDO.setSummary(produceNoticeOrder.getSummary());
            pnoReceiveDeliverDetailDO.setProduceNoticeOrderTime(produceNoticeOrder.getCreateTime());
            pnoReceiveDeliverDetailDO.setDeliveryBatch(1);
            pnoReceiveDeliverDetailDO.setReceiveTime(System.currentTimeMillis());
            pnoReceiveDeliverDetailDO.setReceiveStatus(ReceiveStatusEnum.ALREADY_CONFIRM_RECEIVE.getCode());
            pnoReceiveDeliverDetailDO.setProcessTotalPrice(produceNoticeOrder.getProcessTotalPrice());
            pnoReceiveDeliverDetailDO.setReceiveNum(details.stream().mapToDouble(ProduceNoticeOrderDetailDO::getProcessNum).sum());
            pnoReceiveDeliverDetailDO.setReceivePrice(details.stream().mapToDouble(ProduceNoticeOrderDetailDO::getProcessTotalPrice).sum());
            pnoReceiveDeliverDetailRepository.saveAndFlush(pnoReceiveDeliverDetailDO);

            //新增生产通知单结算信息, 对生成通知单收完货得每一批次进行计算且插入, 针对(是否含税+税率)相同得商品要进行拆分。
            List<PNOSettleDetailDO> list = new ArrayList<>();
            Map<String, List<ProduceNoticeOrderDetailDO>> map = details.stream().collect(Collectors.groupingBy(a -> a.getIsHasTax() + "_" + a.getTaxRate()));
            for (String key:map.keySet()) {
                List<ProduceNoticeOrderDetailDO> bos = map.get(key);
                PNOSettleDetailDO pnoSettleDetailDO = new PNOSettleDetailDO();
                pnoSettleDetailDO.setProduceNoticeOrderId(produceNoticeOrder.getId());
                pnoSettleDetailDO.setPnoReceiveDeliverDetailId(pnoReceiveDeliverDetailDO.getId());
                pnoSettleDetailDO.setNoticeNo(produceNoticeOrder.getNoticeNo());
                pnoSettleDetailDO.setSummary(produceNoticeOrder.getSummary());
                pnoSettleDetailDO.setProduceNoticeOrderTime(produceNoticeOrder.getCreateTime());
                pnoSettleDetailDO.setIsHasTax(bos.get(0).getIsHasTax());
                pnoSettleDetailDO.setTaxRate(bos.get(0).getTaxRate());
                pnoSettleDetailDO.setProcessTotalPrice(produceNoticeOrder.getProcessTotalPrice());
                pnoSettleDetailDO.setBatch(pnoReceiveDeliverDetailDO.getDeliveryBatch());
                pnoSettleDetailDO.setReceiveTime(pnoReceiveDeliverDetailDO.getReceiveTime());
                pnoSettleDetailDO.setReceiveNum(bos.stream().mapToDouble(ProduceNoticeOrderDetailDO::getProcessNum).sum());
                pnoSettleDetailDO.setReceivePrice(bos.stream().mapToDouble(ProduceNoticeOrderDetailDO::getProcessTotalPrice).sum());
                list.add(pnoSettleDetailDO);
            }
            pnoSettleDetailRepository.saveAll(list);

        }else {
            log.error("工作流服务异常:" + outerWrapper.getMessage());
            throw new BusinessException(ResponseCode.ENHANCE_WORKFLOW_ERROR);
        }

        //调用报表服务 -> 新增操作通知（指派生产通知单 - 待收货生产通知单 - 待办减1）
        reportAsyncService.addOperateNotice(
                user.getMemberId(), user.getMemberRoleId(), OperateDataSourceEnum.ENHANCE_SUPPLIER.getCode(),
                null,  null,
                EnhanceSupplierOperateTypeEnum.TO_BE_RECEIVE.getCode(), 1L
        );

        return Wrapper.success();
    }
}
